﻿@model qltscd.Models.BaseClient.DanhMucHopDong
@{
    ViewBag.Title = "Create";
    Layout = "~/Views/Shared/Modules/_LayoutDanhMucNhapLieu.cshtml";
}
<script type="text/javascript">
    function openWindow() {
        var window = getWindow();
        window.center();
        window.open();
    }
    function closeWindow() {
        var window = getWindow();
        window.close();
    }
    function getWindow() {
        return $('#wdSearch').data('tWindow');
    }
    function submitForm() {
        document.location = "/QuanLyThietBi/DanhMucHopDong/Create/?MaHopDong=" + document.getElementById('MaHopDong').value;
    }
    function onOpenWindow() {
        document.getElementById('MaHopDong').value = '';
    }

    function submitTaoHopDong(kieu) {
        document.getElementById("kieuLuu").value = kieu;
        document.forms["TaoHopDong"].submit();
    }
</script>
<script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>
<div style="width: 100%; height: auto; text-align: left; padding-bottom: 15px;">
    @*<input type="button" value="Tìm hợp đồng" class="button" onclick="openWindow();" />&nbsp;*@
</div>
@(
 Html.Telerik().Window()
        .Name("wdSearch")
        .Height(100)
        .Title("Tìm hợp đồng")
        .Width(400)
        .Content(@<text>
@using (Html.BeginForm("Create", "DanhMucHopDong", FormMethod.Post, new { @id = "TimHopDong" })) {
    <text>
    <div style="width: 100%; height: auto; text-align: left;">
        Mã hợp đồng
        <input type="text" style="width: 70%" name="MaHopDong" id="MaHopDong" />
    </div>
    <div style="width: 100%; height: auto; text-align: center; padding-top: 15px;">
        <input type="button" value="Tìm hợp đồng" class="button" onclick="submitForm()" />
        <input type="button" value="Đóng" onclick="closeWindow();" class="button" />
    </div>
    </text>
}
</text>
    )
        .Modal(true)
        .Buttons(button => {
            button.Close();
        })
        .Visible(false)
        .Draggable(true)
        .Resizable()
        .ClientEvents(e => e.OnOpen("onOpenWindow"))
)
@using (Html.BeginForm("Create", "DanhMucHopDong", FormMethod.Post, new { @id = "TaoHopDong" })) {
    @Html.ValidationSummary(true)
    @Html.HiddenFor(o => o.IdentityHopDong)
    <fieldset>
        <legend>Thông tin hợp đồng</legend>
        <table border="0" width="100%" cellpadding="10px" cellspacing="10px">
        <tr>
            <td style="margin-left: 10px; width: 15%;" class="label_col">
                Mã hợp đồng
            </td>
            <td style="width:35%;">
                @Html.TextBoxFor(model => model.MaHopDong, new { @style = "width:97%; " })
            </td>

            <td style="margin-left: 10px; width: 15%;" class="label_col">
                Số hợp đồng
            </td>
            <td style="width:35%;">
                @Html.TextBoxFor(model => model.SoHopDong, new { @style = "width:97%; " })
                
            </td>
         </tr>
         <tr>
            <td style="margin-left: 10px; width:15%;" class="label_col">
                Ngày ký
            </td>
            <td style="width:35%;">
                @(Html.Telerik().DatePicker()
                    .Name("NgayKy")
                    .HtmlAttributes(new { @style = "width:97%; " })
                    .InputHtmlAttributes(new { @style = "width:100%; " })
                    //.Format("{0:dd/MM/yyyy}")
                )
            </td>

            <td style="margin-left: 10px;" class="label_col">
                Người ký
            </td>
            <td>
                @Html.TextBoxFor(model => model.NguoiKy, new { @style = "width:97%; " })
            </td>
          </tr>
          <tr>
            <td style="margin-left: 10px;" class="label_col">
                Thời gian thực hiện
            </td>
            <td>
                @(Html.Telerik().NumericTextBox()
                        .Name("ThoiGianThucHien")
                        .MinValue(0)
                        .DecimalDigits(0)
                        .EmptyMessage("Nhập thời gian thực hiện")
                        .InputHtmlAttributes(new { @style = "width:100%; " })
                        .HtmlAttributes(new { @style = "width: 97%; " })
                        .NumberGroupSize(10)
                    )
                
            </td>
            
            <td style="margin-left: 10px;" class="label_col">
                Tổng kinh phí
            </td>
            <td>
                @(Html.Telerik().CurrencyTextBox()
                        .Name("TongKinhPhi")
                        .HtmlAttributes(new { @style = "width:97%; " })
                        .InputHtmlAttributes(new { @style = "width:100%; " })
                        .EmptyMessage("Nhập tổng kinh phí")
                        .DecimalDigits(0)
                        .CurrencySymbol(" ")
                    )

            </td>
            </tr>
            <tr>
            <td style="margin-left: 10px;" class="label_col">
                Ngày thực hiện
            </td>
            <td>
                @(Html.Telerik().DatePicker()
                    .Name("NgayThucHien")
                    .HtmlAttributes(new { @style = "width:97%; " })
                    .InputHtmlAttributes(new { @style = "width:100%; " })
            //.Format("{0:dd/MM/yyyy}")
                )

            </td>

            <td style="margin-left: 10px;" class="label_col">
                Tỉ giá
            </td>
            <td>
                @(Html.Telerik().NumericTextBox()
                        .Name("TiGia")
                        .HtmlAttributes(new { @style = "width:97%; " })
                        .InputHtmlAttributes(new { @style = "width:100%; " })
                        .EmptyMessage("Nhập tỉ giá")
                        .DecimalDigits(3)
                        .MinValue(0)
                    )

            </td>
            </tr>
            <tr>
                <td style="margin-left: 10px; vertical-align:middle;" class="label_col">
                    Nội dung
                </td>
                <td colspan="3">
                    @Html.TextAreaFor(model => model.NoiDung, new { @style = "width:99%; " })

                </td>    
            </tr>
        </table>
    </fieldset>
    <div class="divButton">
        <input type="submit" value="Lưu" class="button"/>&nbsp;
        <input type="reset" value="Nhập lại" class="button" />&nbsp;
        @Html.ActionLink("Thoát", "Index", null, new { @class = "button" })
    </div>
}
  <div class="errBlock">
                    @Html.ValidationMessageFor(model => model.MaHopDong, "", new { @style = "display:block" })
                    @ViewData[qltscd.Contansts.SessionConstants.ERROR_MESSAGE]
<br />
                    @Html.ValidationMessageFor(model => model.SoHopDong, "", new { @style = "display:block" })
               
                    @Html.ValidationMessageFor(model => model.NgayKy, "", new { @style = "display:block" })
              
                    @Html.ValidationMessageFor(model => model.NguoiKy, "", new { @style = "display:block" })
          
                    @Html.ValidationMessageFor(model => model.ThoiGianThucHien, "", new { @style = "display:block" })
           
                    @Html.ValidationMessageFor(model => model.ThoiGianThucHien, "", new { @style = "display:block" })
              
                    @Html.ValidationMessageFor(model => model.NgayThucHien, "", new { @style = "display:block" })
                
                    @Html.ValidationMessageFor(model => model.TiGia, "", new { @style = "display:block" })
              
                        @Html.ValidationMessageFor(model => model.NoiDung, "", new { @style = "display:block" })
                    </div>